package com.caesar.Abnormal;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author caesar
 * @date 2025/7/14
 * @Description:
 * @apiNote
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Person {
    private String name;//名称
    private int lifeValue;//生命值
    public void setLifeValue(int lifeValue)throws Exception {
        if(lifeValue<0){
            throw new Exception("生命值不能为负数");
        }
        this.lifeValue = lifeValue;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", lifeValue=" + lifeValue +
                '}';
    }
}
